*** Create Table 2, 10 year cohort ***

********************************************************************************

clear 

** read in .dta file **
use "${clean}/who_counts_analysis.dta", clear

** Table 2 focuses only on 10 year cohort. First drop all individuals born after 1955 ** 
drop if YOB > 1955

** Main specification **

xi: reghdfe MOB did_ANY Arabic Female *_itTREATED *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_MOB_did_BW1_any
estimates store m_MOB_did_BW1_any

xi: reghdfe Schooling did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_School_did_BW1_any

xi: reghdfe French_Lit did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LIT_did_BW1_any

xi: reghdfe EDU_YRS did_edu_ANY Arabic Female *_itTREATEDEDU *_itANYFOR, a(geo2_ma reg_fe YOB) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_YRS_did_BW1_any

#delimit ; 
estout m_MOB_did_BW1_any
	   m_School_did_BW1_any
	   m_LIT_did_BW1_any
	   m_YRS_did_BW1_any
       using "${output}/tables/Table2.tex",
       style(tex) 
       cells(b(star fmt(3)) se(par fmt(3))) 
	   	   varlabels(did_ANY "Difference in Differences, registration" did_edu_ANY "Difference in Differences, education"  Female "Female " Arabic "First Language Arabic ")
keep(did_ANY did_edu_ANY)
	   stats(controls
	   adminFE
             r2 
             N
			 ymean, fmt(0 0 2 0 3 %9.0gc %9.0gc)
             labels("\hline Controls"
			 "\hline Admin FE"
                   "\hline \(R^2\)" 
                  " \hline N"
				   "Dep. Var. Mean "))
       mlabels(,none) 
       numbers
       collabels(none) 
       starl(* 0.1 ** 0.05 *** 0.01)
	          prehead( 
           \begin{table}[H]
           \caption{Effect of Reforms and European Settlement on Registration and Education Outcomes, 1945-1955}        
           \label{tab:DiD_BW1}            
           \centering
           \begin{tabular}{@{\extracolsep{4pt}}l*{@M}{c}@{}} 
           \hline \hline             
		   & \multicolumn{1}{p{3cm}}{\centering Registration} 
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling}   
		   & \multicolumn{1}{p{3cm}}{\centering Literacy, Arabic \& French} 
		   & \multicolumn{1}{p{3cm}}{\centering Formal Schooling, Years}                    \\  
       )
       posthead(\hline) 
       prefoot() 
       postfoot(
           \noalign{\smallskip} \hline \hline 
           \end{tabular}
           \medskip
           \begin{minipage}{.9\textwidth}
           \tiny \justify Notes: \( @starlegend \). 
           \\ Fixed Effects and Clustered Robust Standard Errors at Province.
           \end{minipage}        
       \end{table}
       )
       replace;
